home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_ctrllever4.cog < prev    next >
Text File  |  1999-11-15  |  22KB  |  823 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_CtrlLever4.cog
  4. #
  5. # Controls lever 4 only (the stuck one).  Also handles stuff for fixing switch 4.
  6. # Sets up lever in the "pulled" possition (ready for pushing) at level start.
  7. # Swapmesh stuff and callback by [RandyT].
  8. #
  9. # [TRM & revised by HB]
  10. #
  11. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  12. # ========================================================================================
  13.  
  14. symbols
  15.     
  16.     message     startup
  17.     message     user0
  18.     message     user1
  19.     message     activated
  20.     message     callback
  21.    
  22.     thing       player          local
  23.     thing       leverGhost      # Lever position
  24.     thing       indy            # Actor Indy
  25.     thing       trkSwitch       # Track switch
  26.     thing       panelTarget     # focus for control panel
  27.     thing       leverCam        # Watch Indy pull the lever
  28.     
  29.     thing       switchCam       # Switch cam
  30.     thing       ctrlCam1        # Control panel cam
  31.     thing       trk_Cube
  32.     
  33.     thing       pushed          local
  34.     thing       pulled          local
  35.  
  36.     thing        oilindy                                local
  37.     thing        oilcam_1                            local
  38.     thing        oilcam_2                            local
  39.     thing        oiltarg                                local
  40.     thing        oilmark                                local
  41.     
  42.     thing       offsetCam
  43.  
  44.     sector        camsector                            local # var
  45.     
  46.     surface     switch          # Switch texture
  47.     surface     switch1
  48.     surface     switch4
  49.     surface     switch5
  50.     
  51.     # switch track
  52.     surface     switchA
  53.     surface     switchB
  54.     
  55.     # ** cogs **
  56.     cog         comFalls
  57.     cog         hintCog
  58.     cog         comControl     
  59.     
  60.     template    tplLevPull=pullever                    local
  61.     template    tplLevPush=pushlever                local
  62.     template    tpl_indy=indy_sh_actor                local
  63.     template    tpl_ghost=ghost                        local
  64.     
  65.     keyframe    leverPull=gen_lever_pull.key        local
  66.     keyframe    leverPush=gen_lever_push.key        local
  67.     keyframe    indyPull=in_pull_lever.key          local
  68.     keyframe    indyPush=in_push_lever.key          local
  69.     keyframe    indyStuck=in_stuck_lever.key        local
  70.     keyframe    indyStand1=0in_stand4.key            local
  71.     keyframe    indyHat=0in_figithat_4_4.key        local
  72.     keyframe    indyStand2=0in_stand1_bd_4.key        local
  73.     keyframe    use=in_useitem.key                    local    # 83x 
  74.     
  75.     model        sourceModel=hand_in_oilcan.3do        local
  76.     
  77.     # ** sfx **
  78.     sound       sndLever=gen_lever_pull.wav                 local
  79.     sound       sndSwitchTex=sol_panel_switch_c.wav         local
  80.     sound       sndOil=sol_oilcan_c.wav                     local   # squirt, squirt
  81.     
  82.     # ** voice **
  83.     sound       inStuck=Sl02j06.wav         local   # first visit to lever
  84.     sound       inGreaseA=Sl04j01.wav       local   # first visit to switch
  85.     sound       inGreaseB=Sl04j02.wav       local   # second visit to switch
  86.     sound       inFixed=Sl03j03.wav         local   # fuse box and switch fixed
  87.     sound       inJuice=Sl02j04.wav         local   # need juice
  88.     sound       inGrunt=Inxj032a.wav        local   # grunt
  89.     
  90.     vector        v_playpos        local
  91.     vector        v_switchpos        local
  92.     vector        v_oilaim        local
  93.     vector        v_oilspot        local
  94.  
  95.     flex        f_x                local
  96.     flex        f_y                local
  97.     flex        f_z                local
  98.     
  99.     int         powerOn=0       local
  100.     int         ready=1         local
  101.     int         greased=0       local
  102.     int         visitA=1        local
  103.     int         visitB=0        local
  104.     int         playing=0       local
  105.     int         done=0          local
  106.     int         inTrack         local
  107.     int         curCam          local
  108.     
  109.     int         swapRef         local
  110.     int            bSet=0            local
  111.     
  112.     # ** subroutines **
  113.     flex        noPower         local
  114.     flex        stuck           local
  115.     flex        pullLever       local
  116.     flex        pushLever       local
  117.     flex        resetcam        local
  118.     flex        greaseIt        local
  119.     flex        noOilOne        local
  120.     flex        noOilTwo        local
  121.     flex        hasOil          local
  122.     
  123. end
  124.  
  125. # ========================================================================================
  126.  
  127. code
  128.  
  129. startup:
  130.  
  131.     pulled = CreateThing(tplLevPush, leverGhost);
  132.     CaptureThing(pulled);
  133.     
  134.     # Mine Track -- Go Straight
  135.     SetSurfaceFlags(switchA, 0x4000);
  136.     ClearSurfaceFlags(switchB, 0x4000);
  137.     
  138.     return;
  139.  
  140. # ========================================================================================
  141.  
  142. user0:
  143.  
  144.     powerOn = 1;
  145.     return;
  146.  
  147. # ========================================================================================
  148.  
  149. user1:
  150.  
  151.     # rotate track switch from comFalls
  152.     Rotate(trkSwitch, 90, 1, 1.0);
  153.     return;
  154.  
  155. # ========================================================================================
  156.  
  157. activated:
  158.  
  159.     Print("activated: ctrlLever4");
  160.     
  161.     player = GetLocalPlayerThing();
  162.     curCam = GetCurrentCamera();
  163.  
  164. # *************
  165. # ** Lever 4 **
  166. # *************
  167.     
  168.     # no power
  169.     if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (!powerOn) && (!playing))
  170.     {
  171.         playing = 1;
  172.         Call noPower;
  173.     }
  174.     
  175.     # the juice is on but the lever is stuck
  176.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (!greased) && (!playing))
  177.     {
  178.         playing = 1;
  179.         Call stuck;
  180.     }
  181.         
  182.     # Switch is oiled, push lever
  183.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (ready) && (greased))
  184.     {
  185.         ready = 0;
  186.         Call pushLever;
  187.     }
  188.  
  189.     # Switch is oiled, pull lever
  190.     else if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (powerOn) && (ready) && (greased))
  191.     {
  192.         ready = 0;
  193.         Call pullLever;
  194.     }
  195.  
  196. # **************
  197. # ** switch 4 **
  198. # **************
  199.  
  200.     else if((GetSenderRef() == trkSwitch) || (GetSenderRef() == trk_Cube))
  201.     {    
  202.         # player has oil and uses it properly
  203.         if((GetCurItem(player) == 81) && (!greased) && (!playing))
  204.         {
  205.             playing = 1;
  206.             Call greaseIt;
  207.         }
  208.             
  209.         # doesn't have oil and is first visit
  210.         else if((GetInv(player, 81) <= 0) && (visitA) && (!greased))
  211.         {
  212.             Call noOilOne;
  213.         }
  214.     
  215.         # doesn't have oil and is second visit
  216.         else if((GetInv(player, 81) <= 0) && (visitB) && (!greased) && (!playing))
  217.         {
  218.             playing = 1;
  219.             Call noOilTwo;
  220.         }
  221.  
  222.         # has oil, not from inv
  223.         else if((GetInv(player, 81) > 0) && (!greased) && (!playing))
  224.         {
  225.             playing = 1;
  226.             Call hasOil;
  227.         }
  228.     }
  229.            
  230.     return;
  231.         
  232. # ========================================================================================
  233.  
  234. noPower:
  235.  
  236.     # do cutscene stuff
  237.     MakeMeStop();
  238.     StartCutscene(2);
  239.     
  240.     # switch to offsetCam
  241.     SetCameraFocus(2, offsetCam);
  242.     SetCameraSecondaryFocus(2, player);
  243.     SetCurrentCamera(2);
  244.     SetCameraFOV(90, 0, 0.0);
  245.     
  246.     # put away any weapon
  247.     DeselectWeaponWait(player);
  248.     
  249.     # activate lever
  250.     PlayMode(player, 60, 0);
  251.     Sleep(0.3);
  252.     
  253.     # say line
  254.     PlayVoice(player, inJuice, 1.0, 1);
  255.     Sleep(0.5);
  256.     
  257.     # restore controls and camera
  258.     ClearActorFlags(player, 0x200000);
  259.     SetCurrentCamera(curCam);
  260.     
  261.     EndCutscene();
  262.     
  263.     playing = 0;
  264.     
  265.     return;
  266.  
  267. # ========================================================================================
  268.  
  269. stuck:
  270.  
  271.     # do cutscene stuff
  272.     MakeMeStop();
  273.     StartCutscene(2);
  274.     
  275.     # switch to leverCam
  276.     SetCameraFocus(2, leverCam);
  277.     SetCameraSecondaryFocus(2, indy);
  278.     SetCurrentCamera(2);
  279.     SetCameraFOV(90, 0, 0.0);
  280.     
  281.     # put away any weapon
  282.     DeselectWeaponWait(player);
  283.     
  284.     # outfit indy actor
  285.     CopyPlayerHolsters(player, indy);
  286.     
  287.     # hide player, show actor
  288.     SetThingFlags(player, 0x80000);
  289.     ClearThingFlags(indy, 0x80000);
  290.     
  291.     # look at the lever and try to pull
  292.     AISetLookThing(indy, leverGhost);
  293.     PlayKey(indy, indyStuck, 4, 0x12, 0);
  294.     Sleep(1.0);
  295.     PlayVoice(indy, inGrunt, 1.0, 1);
  296.     Sleep(1.0);
  297.     
  298.     # Move camera as Indy adjusts his hat
  299.     MoveToFrame(leverCam, 1, 1.0);
  300.     inTrack = PlayKey(indy, indyStand1, 2, 0x0, 0);
  301.     PlayKey(indy, indyStand2, 4, 0x12, 1);
  302.     PlayVoice(indy, inStuck, 1.0, 0);
  303.     PlayKey(indy, indyHat, 4, 0x12, 1);
  304.     StopKey(indy, inTrack, 0.5);
  305.     Sleep(1.0); # may need adjusting for foreign language versions
  306.  
  307.     # moeve leverCam back to frame0 (necessary?)
  308.     MoveToFrame(leverCam, 0, 10.0);
  309.     
  310.     # hide actor show player
  311.     SetThingFlags(indy, 0x80000);
  312.     ClearThingFlags(player, 0x80000);
  313.     
  314.     # restore controls
  315.     ClearActorFlags(player, 0x200000);
  316.     
  317.     # restore camera
  318.     SetCameraPosition(curcam, GetThingPos(leverCam));
  319.     SetCurrentCamera(curCam);
  320.     
  321.     EndCutscene();
  322.     playing = 0;
  323.         
  324.     return;
  325.     
  326. # ========================================================================================
  327.  
  328. pushlever:
  329.  
  330.     global0 = 0;
  331.     global1 = 1;
  332.     global2 = 0;
  333.     
  334.     # tell hintCog to check switch positions
  335.     SendMessage(hintCog, user1);
  336.     
  337.     # do cutscene stuff
  338.     MakeMeStop();
  339.     StartCutscene(2);
  340.     
  341.     # switch to offsetCam
  342.     SetCameraFocus(2, offsetCam);
  343.     SetCameraSecondaryFocus(2, player);
  344.     SetCurrentCamera(2);
  345.     SetCameraFOV(90, 0, 0.0);
  346.     
  347.     # put away any weapon
  348.     DeselectWeaponWait(player);
  349.  
  350.     # outfit indy actor
  351.     CopyPlayerHolsters(player, indy);
  352.     
  353.     # show actor hide player
  354.     SetThingFlags(player, 0x80000);
  355.     ClearThingFlags(indy, 0x80000);
  356.     
  357.     # push the lever
  358.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  359.     PlayKey(indy, indyPush, 4, 0x12, 0);
  360.     Sleep(0.75);
  361.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  362.     
  363.     # Cut to Control Panel cam
  364.     SetCameraFocus(2, ctrlCam1);
  365.     SetCameraSecondaryFocus(2, panelTarget);
  366.     SetCurrentCamera(2);
  367.     SetCameraFOV(90, 0, 0.0);
  368.     Sleep(0.5);
  369.     
  370.     # flip panel switch
  371.     SetWallCel(switch, 2);
  372.     PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 1);
  373.     
  374.     # go about business as usual
  375.     if(global3 == 1)
  376.     {
  377.         # Cut to switch cam
  378.         SetCameraFocus(2, switchCam);
  379.         SetCameraSecondaryFocus(2, trkSwitch);
  380.         SetCurrentCamera(2);
  381.         SetCameraFOV(90, 0, 0.0);
  382.         
  383.         # rotate track switch
  384.         Rotate(trkSwitch, 90, 1, 1.0);
  385.         Sleep(2.0);
  386.         
  387.         # hide indy show player
  388.         SetThingFlags(indy, 0x80000);
  389.         ClearThingFlags(player, 0x80000);
  390.         
  391.         # restore camera
  392.         SetCurrentCamera(curCam);
  393.         
  394.         # restore controls
  395.         ClearActorFlags(player, 0x200000);
  396.         EndCutscene();
  397.     }
  398.     
  399.     # deal with comCar issues
  400.     else if(global3 == 0)
  401.     {
  402.         # switch1 and switch4 are ready, switch5 is not: do partial
  403.         if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 2))
  404.         {
  405.             #Print("CtrlLever4 -- 1 and 4 ready, 5 not ready");
  406.             
  407.             # hide indy show player
  408.             SetThingFlags(indy, 0x80000);
  409.             ClearThingFlags(player, 0x80000);
  410.             
  411.             # watch comCar enter switch4 from comCam1
  412.             SendMessage(comFalls, user2);
  413.             
  414.             # tell comFalls to do partial
  415.             SendMessage(comFalls, user0);
  416.             
  417.             # Cut to switch cam
  418.             SetCameraFocus(2, switchCam);
  419.             SetCameraSecondaryFocus(2, trkSwitch);
  420.             SetCurrentCamera(2);
  421.             SetCameraFOV(90, 0, 0.0);
  422.             
  423.             # rotate track switch
  424.             Rotate(trkSwitch, 90, 1, 1.0);
  425.             Sleep(2.0);
  426.             
  427.             # Mine Track -- turn off
  428.             SetSurfaceFlags(switchB, 0x4000);
  429.             ClearSurfaceFlags(switchA, 0x4000);
  430.         }
  431.             
  432.         # switch1 not ready: do nothing
  433.         else if(GetWallCel(switch1) == 1)
  434.         {
  435.             #Print("CtrlLever4 -- Switch 1 not ready");
  436.             
  437.             # Cut to switch cam
  438.             SetCameraFocus(2, switchCam);
  439.             SetCameraSecondaryFocus(2, trkSwitch);
  440.             SetCurrentCamera(2);
  441.             SetCameraFOV(90, 0, 0.0);
  442.             
  443.             # rotate track switch
  444.             Rotate(trkSwitch, 90, 1, 1.0);
  445.             Sleep(2.0);
  446.     
  447.             # hide indy show player
  448.             SetThingFlags(indy, 0x80000);
  449.             ClearThingFlags(player, 0x80000);
  450.             
  451.             # restore camera
  452.             SetCurrentCamera(curCam);
  453.             
  454.             # restore controls
  455.             ClearActorFlags(player, 0x200000);
  456.             EndCutscene();
  457.         }
  458.             
  459.         # switches 1, 4 and 5 are ready: Send commies over the edge
  460.         else if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 1))
  461.         {
  462.             #Print("CtrlLever4 -- send commies over edge");
  463.             
  464.             # hide indy show player
  465.             SetThingFlags(indy, 0x80000);
  466.             ClearThingFlags(player, 0x80000);
  467.             
  468.             # watch comCar enter switch4 from comCam1
  469.             SendMessage(comFalls, user2);
  470.             
  471.             # tell comFalls to send comCar over the edge
  472.             SendMessage(comFalls, user0);
  473.             
  474.             # we're all done with this global0 stuff
  475.             global3 = 1;
  476.         }
  477.     }
  478.         
  479.     Sleep(1.0);
  480.     
  481.     # Destroy pulled lever and create pushed lever
  482.     DestroyThing(pulled);
  483.     pushed = CreateThing(tplLevPull, leverGhost);
  484.     CaptureThing(pushed);
  485.     
  486.     # Mine Track -- turn off
  487.     SetSurfaceFlags(switchB, 0x4000);
  488.     ClearSurfaceFlags(switchA, 0x4000);
  489.     
  490.     ready = 1;
  491.         
  492.     return;
  493.     
  494. # ========================================================================================
  495.  
  496. pullLever:
  497.  
  498.     global1 = 0;
  499.     
  500.     # tell hintCog to check switch positions
  501.     SendMessage(hintCog, user1);
  502.     
  503.     # do cutscene stuff
  504.     MakeMeStop();
  505.     StartCutscene(2);
  506.     
  507.     # switch to offsetCam
  508.     SetCameraFocus(2, offsetCam);
  509.     SetCameraSecondaryFocus(2, player);
  510.     SetCurrentCamera(2);
  511.     SetCameraFOV(90, 0, 0.0);
  512.     
  513.     # put away any weapon
  514.     DeselectWeaponWait(player);
  515.  
  516.     # outfit indy actor
  517.     CopyPlayerHolsters(player, indy);
  518.     
  519.     # show actor hide player
  520.     SetThingFlags(player, 0x80000);
  521.     ClearThingFlags(indy, 0x80000);
  522.     
  523.     # pull the lever
  524.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  525.     PlayKey(indy, indyPull, 4, 0x12, 0);
  526.     Sleep(0.85);
  527.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  528.     
  529.     # Cut to Control Panel cam
  530.     SetCameraFocus(2, ctrlCam1);
  531.     SetCameraSecondaryFocus(2, panelTarget);
  532.     SetCurrentCamera(2);
  533.     SetCameraFOV(90, 0, 0.0);
  534.     Sleep(0.5);
  535.     
  536.     # flip panel switch
  537.     SetWallCel(switch, 1);
  538.     PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 1);
  539.     Sleep(0.5);
  540.     
  541.     # Cut to switch cam
  542.     SetCameraFocus(2, switchCam);
  543.     SetCameraSecondaryFocus(2, trkSwitch);
  544.     SetCurrentCamera(2);
  545.     
  546.     # rotate track switch
  547.     SetCameraFOV(90, 0, 0.0);
  548.     Rotate(trkSwitch, -90, 1, 1.0);
  549.     Sleep(2.0);
  550.     
  551.     # hide indy show player
  552.     SetThingFlags(indy, 0x80000);
  553.     ClearThingFlags(player, 0x80000);
  554.     
  555.     # restore camera
  556.     SetCurrentCamera(curCam);
  557.     
  558.     # restore controls
  559.     ClearActorFlags(player, 0x200000);
  560.     
  561.     # Destroy pushed lever and create pulled lever
  562.     DestroyThing(pushed);
  563.     pulled = CreateThing(tplLevPush, leverGhost);
  564.     CaptureThing(pulled);
  565.     
  566.     # Mine Track -- Go Straight
  567.     SetSurfaceFlags(switchA, 0x4000);
  568.     ClearSurfaceFlags(switchB, 0x4000);
  569.     
  570.     EndCutscene();
  571.     ready = 1;
  572.         
  573.     return;
  574.     
  575. # ========================================================================================
  576.  
  577. resetcam:
  578.  
  579.     #Print("lever4 -- resetcam");
  580.     
  581.     # hide indy show player
  582.     SetThingFlags(indy, 0x80000);
  583.     ClearThingFlags(player, 0x80000);
  584.     
  585.     # restore camera
  586.     SetCurrentCamera(curCam);
  587.     
  588.     # restore controls
  589.     ClearActorFlags(player, 0x200000);
  590.     EndCutscene();
  591.     
  592.     return;
  593.  
  594. # ========================================================================================
  595.  
  596. greaseIt:
  597.  
  598.     greased = 1;
  599.     
  600.     DestroyThing(trk_Cube);
  601.     
  602.     # Prep...
  603.     MakeMeStop();
  604.     StartCutscene(2);
  605.     DeselectWeaponWait(player);
  606.     
  607.     # Make an actor & aim him...
  608.     oilindy = CreateThing(tpl_indy, player);
  609.     CaptureThing(oilindy);
  610.     v_playpos = GetThingPos(player);
  611.     v_switchpos = GetThingPos(trkSwitch);
  612.     f_x  = VectorX(v_switchpos);
  613.     f_y = VectorY(v_switchpos);
  614.     f_z = VectorZ(v_playpos);
  615.     v_switchpos = VectorSet(f_x, f_y, f_z); # force same height
  616.     v_oilaim = VectorNorm(VectorSub(v_switchpos, v_playpos));
  617.     SetThingLook(oilindy, v_oilaim);
  618.  
  619.     # Make cam 1...
  620.     v_oilspot = VectorAdd(VectorTransformToOrient(player, '0.3 -0.1 0.05'), v_playpos);    
  621.     camsector = FindNewSectorFromThing(trkSwitch, v_oilspot);
  622.     oilcam_1 = CreateThingAtPos(tpl_ghost, camsector, v_oilspot, '0 0 0');
  623.     CaptureThing(oilcam_1);
  624.  
  625.     # Make cam 2...
  626.     v_oilspot = VectorAdd(VectorTransformToOrient(player, '0.2 0.2 0.1'), v_playpos);    
  627.     camsector = FindNewSectorFromThing(trkSwitch, v_oilspot);
  628.     oilcam_2 = CreateThingAtPos(tpl_ghost, camsector, v_oilspot, '0 0 0');
  629.     CaptureThing(oilcam_2);
  630.  
  631.     # Make actor mark & aim it...
  632.     v_oilspot = VectorAdd(VectorTransformToOrient(player, '0.0 -0.03 0.0'), v_playpos);    
  633.     camsector = FindNewSectorFromThing(trkSwitch, v_oilspot);
  634.     oilmark = CreateThingAtPos(tpl_ghost, camsector, v_oilspot, '0 0 0');
  635.     CaptureThing(oilmark);
  636.     v_oilaim = VectorNorm(VectorSub(v_switchpos, GetThingPos(oilmark)));
  637.     SetThingLook(oilmark, v_oilaim);
  638.  
  639.     # Make a cam target...
  640.     v_oilspot = VectorAdd(VectorTransformToOrient(oilmark, '0.0 0.06 -0.01'), GetThingPos(oilmark));    
  641.     camsector = FindNewSectorFromThing(trkSwitch, v_oilspot);
  642.     oiltarg = CreateThingAtPos(tpl_ghost, camsector, v_oilspot, '0 0 0');
  643.     CaptureThing(oiltarg);
  644.  
  645.     # Put actor on mark...
  646.     TeleportThing(oilindy, oilmark);
  647.     AISetLookThing(oilindy, oiltarg);
  648.  
  649.     # Cut to indy oiling switch...
  650.     SetCameraLookInterp(2, 0);
  651.     SetCameraPosInterp(2, 0);
  652.     SetCameraFocus(2, oilcam_1);
  653.     SetCameraSecondaryFocus(2, oiltarg);
  654.     SetCurrentCamera(2);
  655.     SetCameraLookInterp(2, 1);
  656.     SetCameraPosInterp(2, 1);
  657.     SetCameraInterpSpeed(2, 5.0);
  658.     SetThingFlags(player, 0x80000);
  659.     ClearThingFlags(oilindy, 0x80000);
  660.     CopyPlayerHolsters(player, oilindy);
  661.     
  662.     # Play the tagged keyframe...
  663.     PlayKey(oilindy, use, 5, 0x12, 0);
  664.     Sleep(0.01);
  665.  
  666.     # Dolly around...
  667.     SetCameraFocus(2, oilcam_2);
  668.     Sleep(1.0);
  669.     PlaySoundLocal(sndOil, 1.0, 0.0, 0x0, 0);
  670.     Sleep(2.0);
  671.    
  672.     # Indy: "Let's see if that changes my luck."
  673.     PlayVoice(oilindy, inFixed, 1.0, 1);
  674.     
  675.     # change inventory...
  676.     ChangeInv(player, 81, -1);
  677.     Sleep(0.2);
  678.     
  679.     # Restore controls and camera...
  680.     TeleportThing(player, oilindy);
  681.     SetThingFlags(oilindy, 0x80000);
  682.     ClearThingFlags(player, 0x80000);
  683.     SetCameraLookInterp(2, 0);
  684.     SetCameraPosInterp(2, 0);
  685.  
  686.     SetCameraPosition(1, GetThingPos(oilcam_1));
  687.     SetCurrentCamera(1);
  688.  
  689.     EndCutscene();
  690.     ClearActorFlags(player, 0x200000);
  691.     Sleep(0.1);
  692.     DestroyThing(oilindy);
  693.     DestroyThing(oilcam_1);
  694.     DestroyThing(oilcam_2);
  695.     DestroyThing(oiltarg);
  696.     DestroyThing(oilmark);
  697.     
  698.     playing = 0;
  699.     
  700.     # tell hintCog to solve hint15
  701.     SendMessage(hintCog, user0);
  702.     
  703.     # turn on second wave of level commies
  704.     SendMessage(comControl, user2);
  705.     
  706.     return;
  707.     
  708. # ========================================================================================
  709.  
  710. noOilOne:
  711.  
  712.     visitA = 0;
  713.             
  714.     # do cutscene stuff
  715.     MakeMeStop();
  716.     StartCutscene(2);
  717.     
  718.     # offset camera
  719.     SetExtCamOffset('-0.2 0.0 0.065');
  720.     
  721.     # put away any weapon
  722.     DeselectWeaponWait(player);
  723.     
  724.     # activate switch
  725.     PlayMode(player, 60, 0);
  726.     Sleep(0.3);
  727.     
  728.     # play voice line
  729.     PlayVoice(player, inGreaseA, 1.0, 1);
  730.     
  731.     # restore controls and camera
  732.     ClearActorFlags(player, 0x200000);
  733.     RestoreExtCam();
  734.     
  735.     EndCutscene();
  736.     visitB = 1;
  737.     
  738.     return;
  739.     
  740. # ========================================================================================
  741.  
  742. noOilTwo:
  743.  
  744.     # do cutscene stuff
  745.     MakeMeStop();
  746.     StartCutscene(2);
  747.     
  748.     # offset camera
  749.     SetExtCamOffset('-0.2 0.0 0.065');
  750.     
  751.     # put away any weapon
  752.     DeselectWeaponWait(player);
  753.     
  754.     # activate switch
  755.     PlayMode(player, 60, 0);
  756.     Sleep(0.3);
  757.     
  758.     # play voice line
  759.     PlayVoice(player, inGreaseB, 1.0, 1);
  760.     
  761.     # restore controls and camera
  762.     ClearActorFlags(player, 0x200000);
  763.     RestoreExtCam();
  764.     
  765.     EndCutscene();
  766.     playing = 0;
  767.     
  768.     return;
  769.     
  770. # ========================================================================================
  771.  
  772. hasOil:
  773.  
  774.     # do cutscene stuff
  775.     MakeMeStop();
  776.     StartCutscene(2);
  777.     
  778.     # offset camera
  779.     SetExtCamOffset('-0.2 0.0 0.065');
  780.     
  781.     # put away any weapon
  782.     DeselectWeaponWait(player);
  783.     
  784.     # activate switch
  785.     PlayMode(player, 60, 0);
  786.     Sleep(0.3);
  787.     
  788.     # play voice line
  789.     PlayVoice(player, inGreaseB, 1.0, 1);
  790.     
  791.     # restore controls and camera
  792.     ClearActorFlags(player, 0x200000);
  793.     RestoreExtCam();
  794.     
  795.     EndCutscene();
  796.     playing = 0;
  797.     
  798.     return;
  799.     
  800. # ========================================================================================
  801.  
  802. callback:
  803.  
  804.     # Setting
  805.     if (!bSet)
  806.     {
  807.         swapRef = SetThingMesh(oilindy, 15, sourceModel, 0);
  808.     }
  809.     
  810.     # Restoring
  811.     else
  812.     {
  813.         RestoreThingMesh(oilindy, swapRef);        
  814.     }                                         
  815.         
  816.     bSet = 1 - bSet;
  817.     return;
  818.  
  819. # ========================================================================================
  820.  
  821. end
  822.  
  823.